import {defineStore} from "pinia";

export const definePerson = defineStore('personPinia',
    {

        state: () => {
            return {
                username: '张三',
                age: 0,
                hobbies: ['唱歌', '跳舞']
            }
        },
        getters: {
            getHobbiesCount(state) {
                return state.hobbies.length
            },
            getAge(state) {
                return state.age
            }
        },
        actions: {
            doubleAge() {
                this.age = this.age * 2
            }
        }
    }
)